import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import confusion_matrix

df = pd.read_excel('C:/Users/zlsjNKJS/Desktop/090/val.xlsx')

predicted_column = 'BRISQUE点击率分组预测结果'
actual_column = '点击率分组'

y_true = df[actual_column].values
y_pred = df[predicted_column].values
cm=confusion_matrix(y_true,y_pred)

plt.figure(figsize=(10,7))
sns.heatmap(cm,annot=True, fmt='d', cmap='Blues',
            xticklabels=df[actual_column].unique(),
            yticklabels=df[actual_column].unique())

plt.title('Multi-Class Confusion Matrix')
plt.xlabel('Predicted Label')
plt.ylabel('True label')

plt.show()